package com.website.util
{
	import com.website.view.LayerManager;

	public class Constant
	{
		public static var path:String = "http://www.richardmeier.com/";
		public static var overBackBtn:Boolean = false;
		public static var overFullscreenIcon:Boolean = false;
		public static var coldColor:String = "0x777777";
		public static var overColor:String = "0x000000";
		public static var hotColor:String = "0xff3300";
		public static var fadeSpeed:Number = 0.5;
		public static var coldColorHTML:String = "#777777";
		public static var currBookmark:String = "page";
		public static var hotColorHTML:String = "#ff3300";
		
		public static var unitH:Number;
		public static var unitW:Number;
		
		public static var gutterW:Number;
		public static var gutterH:Number;
		
		public static var gridH:Number;
		public static var gridMaxH:Number;
		public static var gridW:Number;
		public static var gridX:Number;
		public static var gridY:Number;
		public static var gridMaxW:Number;
		public static var headerH:Number;
		public static var headerW:Number;
		
		public static var unitRatioH:Number;
		public static var unitRatioW:Number;
		public static var xBorder:int;
		public static var yBorder:int;
		public static var gutterRatioW:Number;
		public static var gutterRatioH:Number
		public static var unitRows:int
		public static var unitCols:int
		public static var gridCurrW:Number;
		public static var gridCurrH:Number;
		
		public static function doResize():void
		{
			gridMaxW = 999;
			gridMaxH = 774;
			xBorder = 20;
			yBorder = 20;
			unitRows = 6;
			unitCols = 12;
			unitRatioW = 0.075;
			unitRatioH = 0.151;
			gutterRatioW = 0.099;
			gutterRatioH = 0.058;
			resizeGrid();
//			if (menuShell != null)
//			{
//				menuShell.x = gridX;
//				menuShell.y = gridY;
//			}
//			if (homeShell != null)
//			{
//				homeShell.x = gridX;
//				homeShell.y = gridY;
//			}
//			if (globalIcons != null)
//			{
//				globalIcons.x = Math.round(stage.stageWidth - 27);
//				globalIcons.y = 9;
//			}
//			if (loaderbar != null)
//			{
//				loaderbar.x = Math.round(gridX + 4 * (unitW + gutterW));
//				loaderbar.y = Math.round(gridY + headerH + 3 * unitH + 2 * gutterH);
//				loaderbar.width = Math.round(4 * unitW + 3 * gutterW);
//				loaderbar.height = 1;
//			}
//			if (stage.displayState == StageDisplayState.FULL_SCREEN)
//			{
//				if (backBtn != null)
//				{
//					backBtn.visible = true;
//				}
//			}
//			else if (backBtn != null)
//			{
//				backBtn.visible = false;
//			}
			return;
		}
		
		public static function resizeGrid() : void
		{
			var _loc_1:* = undefined;
			var _loc_2:int = 0;
			var _loc_3:int = 0;
			gridW = Math.round(LayerManager.stage.stageWidth - 2 * xBorder);
			if (gridW >= gridMaxW)
			{
				gridW = gridMaxW;
			}
			gridH = Math.round(gridMaxH * (gridW / gridMaxW));
			if (gridH <= 550)
			{
				gridH = 550;
			}
			gridW = Math.round(gridMaxW * (gridH / gridMaxH));
			if (gridW >= Math.round(LayerManager.stage.stageWidth - 2 * xBorder))
			{
				gridW = Math.round(LayerManager.stage.stageWidth - 2 * xBorder);
				gridH = Math.round(gridMaxH * (gridW / gridMaxW));
			}
			if (gridH >= Math.round(LayerManager.stage.stageHeight - 2 * yBorder - 20))
			{
				gridH = Math.round(LayerManager.stage.stageHeight - 1 * yBorder);
				if (gridH >= gridMaxH)
				{
					gridH = gridMaxH;
				}
				if (gridH <= 550)
				{
					gridH = 550;
				}
				gridW = Math.round(gridMaxW * (gridH / gridMaxH));
				if (gridW >= Math.round(LayerManager.stage.stageWidth - 2 * xBorder))
				{
					gridW = Math.round(LayerManager.stage.stageWidth - 2 * xBorder);
					gridH = Math.round(gridMaxH * (gridW / gridMaxW));
				}
				gridX = Math.round((LayerManager.stage.stageWidth - gridW) / 2);
				gridY = Math.round(0);
			}
			else
			{
				gridX = Math.round((LayerManager.stage.stageWidth - gridW) / 2);
				gridY = Math.round((LayerManager.stage.stageHeight - gridH) / 2);
			}
			unitW = Math.round(unitRatioW * gridW);
			unitH = Math.round(unitRatioH * gridH);
			gutterW = gridW * gutterRatioW / 11;
			gutterH = gridH * gutterRatioH / 5;
			headerW = Math.round(12 * unitW + 11 * gutterW);
			headerH = Math.round(gutterH * 3);
			gridCurrW = Math.round(12 * unitW + 11 * gutterW);
			gridCurrH = Math.round(6 * unitH + 5 * gutterH + headerH);
			_loc_1 = 0;
			_loc_2 = 0;
//			while (_loc_2 < unitRows)
//			{
//				
//				_loc_3 = 0;
//				while (_loc_3 < unitCols)
//				{
//					
//					unitsArray[_loc_1].width = unitW;
//					unitsArray[_loc_1].height = unitH;
//					unitsArray[_loc_1].x = Math.round(gridX + _loc_3 * (unitW + gutterW));
//					unitsArray[_loc_1].y = Math.round(gridY + headerH + _loc_2 * (unitH + gutterH));
//					_loc_1 = _loc_1 + 1;
//					_loc_3++;
//				}
//				_loc_2++;
//			}
			return;
		}
	}
}